import {
    spaceResourcesQuery
  } from 'api/space';

  export default {
      namespace: 'graphics',
      state: {
        SpaceResource: [],
      },

      effects: {
        *spaceResourcesQuery({ payload }, { call, put }) {
          const data = yield call(spaceResourcesQuery, payload)
          if (data && data.success) {
            yield put({
              type: 'setState',
              payload: {
                SpaceResource: data.data,
              },
            })
          } else {
            throw data
          }
        },
      },

      reducers: {
        setState(state, action) {
          return {
              ...state,
              ...action.payload
          };
        }
      },
    }
